package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.WendaAnswer;
import cn.wolfcode.luowowo.article.mapper.WendaAnswerMapper;
import cn.wolfcode.luowowo.article.service.IWendaAnswerService;
import cn.wolfcode.luowowo.common.query.WendaAnswerQueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class WendaAnswerServiceImpl implements IWendaAnswerService {

    @Autowired
    private WendaAnswerMapper wendaAnswerMapper;

    public PageInfo query(WendaAnswerQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        return new PageInfo(wendaAnswerMapper.selectForList(qo));
    }


    public List<WendaAnswer> queryAll() {
        return wendaAnswerMapper.selectAll();
    }


    public void save(WendaAnswer answer) {

        wendaAnswerMapper.insert(answer);

    }
}
